import request from '../../../utils/request'
import qs from 'qs'

// 查询地点类型列表
export function listType (query) {
  return request({
    url: '/system/config/dict/list',
    method: 'get',
    params: query
  })
}

// 导出字典类型
export function exportType (query) {
  return request({
    url: '/system/config/dict/export',
    method: 'get',
    params: query
  })
}

// 删除字典类型
export function delType (dictId) {
  let dictIds = []
  if (!Array.isArray(dictId)) {
    dictIds.push(dictId)
  } else {
    dictIds = dictId
  }
  return request({
    url: '/system/config/dict/delete',
    method: 'delete',
    data: dictIds
  })
}

// 新增字典类型
export function addType (data) {
  return request({
    url: '/system/config/dict/add',
    method: 'post',
    data: qs.stringify(data)
  })
}
// 更新字典类型
export function updateType (data) {
  return request({
    url: '/system/config/dict/update',
    method: 'post',
    data: qs.stringify(data)
  })
}
// 查询字典类型详细
export function getType (dictId) {
  return request({
    url: '/system/config/dict/getDetail?dictId=' + dictId,
    method: 'get'
  })
}
